using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
using Entities;
using DAL;
using Utility;
namespace BUS
{
   public  class tbLoaiSPBUS
    {
        public static void Insert(tbLoaiSP loaisp)
        {
            tbLoaiSPDAL LSP = new tbLoaiSPDAL();
            LSP.Insert(loaisp);
        }
        public static void Update(tbLoaiSP loaisp)
        {
            tbLoaiSPDAL LSP = new tbLoaiSPDAL();
            LSP.Update(loaisp);
        }
        public static void delete(int Id)
        {
            tbLoaiSPDAL LSP = new tbLoaiSPDAL();
            LSP.Delete(Id);
        }
        public static tbLoaiSPCollection Get(string Where, int PageIndex,
                                                int PageSize, string OrderBy,
                                                string OrderDirection, out int Total)
        {
            tbLoaiSPDAL LSP = new tbLoaiSPDAL();
            return LSP.Get(Where, PageIndex, PageSize, OrderBy, OrderDirection, out Total);
        }
        public static tbLoaiSPCollection GetAll()
        {
            int Total = 0;
            Criteria cr = new Criteria();
            tbLoaiSPDAL LSP = new tbLoaiSPDAL();
            return LSP.Get(cr.Criter, 0, 0,
                             tbLoaiSPColumns.IdLoaiSP  .ToString(), 
                             OrderDirection .ASC .ToString (), out Total);
        }
        public static tbLoaiSP  GetId(int Id)
        {
            int Total = 0;
            Criteria cr = new Criteria();
            cr.add(Condition.AND, tbLoaiSPColumns.IdLoaiSP  , Condition.LIKE, Id);
            tbLoaiSPDAL LSP = new tbLoaiSPDAL();
            tbLoaiSPCollection loaispcollection = LSP.Get(cr.Criter, 0, 0,
                                              tbLoaiSPColumns.IdLoaiSP  .ToString(),
                                              OrderDirection.ASC.ToString(), out Total);
            if (loaispcollection.Count > 0)
                return loaispcollection[0];
            return null ;
        }
    }
}
